home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / packer / lzw14 / expand.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-12  |  912 b   |  42 lines

  1. /*
  2. **  EXPAND.C      Copyright (C) 1992 by MarshallSoft Computing, Inc.
  3. **
  4. **  Expands file previously compressed with COMPRESS.
  5. **  Usage is:  EXPAND <input_file> <output_file>
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include "LZW4C.H"
  11. #include "RW_IO.H"
  12. #include "SAYERROR.H"
  13.  
  14. #define FALSE 0
  15. #define TRUE !FALSE
  16.  
  17. void main(int argc,char *argv[])
  18. {int RetCode;
  19.  /* begin */
  20.  if(argc<3)
  21.    {printf("Useage: EXPAND <infile> <outfile>\n");
  22.     exit(1);
  23.    }
  24.  if((RetCode=InitLZW(malloc,14))<0)
  25.    {SayError(RetCode);
  26.     exit(2);
  27.    }
  28.  /* open input file */
  29.  if(!ReaderOpen(argv[1])) exit(3);
  30.  /* open output file */
  31.  if(!WriterOpen(argv[2])) exit(4);
  32.  /* expand the compressed file */
  33.  printf("Expanding %s",argv[1]);
  34.  if((RetCode=Expand(Reader,Writer))<0)
  35.    {SayError(RetCode);
  36.     exit(3);
  37.    }
  38.  /* close files */
  39.  ReaderClose();
  40.  WriterClose();
  41.  TermLZW(free);
  42. }